//
//  MGCNetworkTools.m
//  DivinationHouse
//
//  Created by N on 2018/8/24.
//  Copyright © 2018年 Magic. All rights reserved.
//

#import "MGCNetworkTools.h"

@implementation MGCNetworkTools
static MGCNetworkTools *_networkTools;
+ (MGCNetworkTools *)MGCnetworkTools {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _networkTools = [[MGCNetworkTools alloc] init];
    });
    return _networkTools;
}

- (instancetype)init {
    if (self = [super init]) {
        _MGCmanager = [AFHTTPSessionManager manager];
        _MGCmanager.responseSerializer = [AFJSONResponseSerializer serializer];
        _MGCmanager.requestSerializer = [AFJSONRequestSerializer serializer];
        [_MGCmanager.requestSerializer setValue:@"application/json;charset=utf-8" forHTTPHeaderField:@"Content-Type"];
        _MGCmanager.responseSerializer.acceptableContentTypes = [_MGCmanager.responseSerializer.acceptableContentTypes setByAddingObject:@"application/json"];
        _MGCmanager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    }
    return self;
}


@end
